package com.ruoyi.system.enums;

/**
 * @description: 房间状态
 * @author 强盛酒店
 */
public enum RoomStatusEnum {
    /**
     * 空闲
     */
    FREE(1, "空闲"),
    /**
     * 已预约
     */
    APPOINTMENT(2, "已预约"),
    /**
     * 已入住
     */
    BEEN_IN(3, "已入住"),
    /**
     * 待清洁
     */
    WAIT_CLEAN(4, "待清洁");
    /**
     * 类型
     */
    Integer code;
    /**
     * 名称
     */
    String name;

    RoomStatusEnum(Integer code, String name) {
        this.name = name;
        this.code = code;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getName() {
        return this.name;
    }

    /**
     * 得到枚举
     */
    public static RoomStatusEnum getEnum(Integer code) throws Exception {
        RoomStatusEnum[] roomStatusEnums = RoomStatusEnum.values();
        for (int i = 0; i < roomStatusEnums.length; i++) {
            if (roomStatusEnums[i].getCode().equals(code)) {
                return roomStatusEnums[i];
            }
        }
        throw new Exception("没有找到相应的枚举!");
    }
}
